#ifndef MIXEDDER_H
#define MIXEDDER_H

#if DIM == 2

#include "FiniteDiff/RectDomain.h"
#include "Core/Tensor.h"

class MixedDer
{
public:
  enum { Dim = 2 };

  MixedDer(const RectDomain<Dim> &aRd, const Vec<Real, 3> &aA)
      : rd(aRd), A(aA)
  {
  }

  template <class T>
  void apply(Real alpha, const Tensor<Real, Dim> &phi, const T &rhs, Tensor<Real, Dim> &LofPhi) const;

  void apply(const Tensor<Real, Dim> &phi, Tensor<Real, Dim> &LofPhi) const;

  void apply(const Tensor<Real, Dim> &phi, const Tensor<Real, Dim> &rhs, Tensor<Real, Dim> &rsd) const;

  void relax(const Tensor<Real, Dim> &phi, const Tensor<Real, Dim> &rhs, Tensor<Real, Dim> &JofPhi, Real w = 1.0) const;

protected:
  const RectDomain<Dim> rd;
  Vec<Real, 3> A;
};

#else
//#warning "MixedDer is omitted for 3D. "
#endif // DIM == 2

#endif //MIXEDDER_H
